<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Account console</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js" async="async"></script>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/admin_index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/window.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/tw.css') }}">
    <script src="{{ url_for('static',filename='javascript/view_information.js') }}"></script>
</head>

<body>

    <div class="view_message">
        <p>{{ title }}</p>

        <!-- 查看帖子 -->
        {% if mode == "View Forum"%}
        <form>
            <label for="forum_id">Forum ID</label>
            <input name="forum_id" id="forum_id" type="text" value="{{forum[0]}}" readonly class="input mb-3">

            <label for="category">Category</label>
            <input name="category" id="category" type="text" value="{{forum[1]}}" readonly class="input mb-3">

            <label for="title">Title</label>
            <input name="title" id="title" type="text" value="{{forum[2]}}" readonly class="input mb-3">

            <label for="content">Content</label>
            <textarea name="content" id="content" rows="4" disabled class="input h-auto mb-3">{{forum[3]}}</textarea>

            <label for="author">Author</label>
            <input name="author" id="author" type="text" value="{{forum[4]}}" readonly class="input mb-3">

            <label for="created_at">Created At</label>
            <input name="created_at" id="created_at" type="text" value="{{forum[5]}}" readonly class="input mb-3">

            <h3 class="mb-2 pb-2 border-b">Comments List</h3>
            <ul class="mb-5 none-list-style">
                {% for comment in comments %}
                <li class="flex flex-col border-b pb-2 mb-2">
                    <div>{{ comment[0] }}: {{ comment[1] }}</div>
                    <div class="self-end">{{ comment[2] }}</div>
                </li>
                {% endfor %}
                <!-- <li class="flex flex-col border-b pb-2 mb-2">
                    <div>评论人: 评论内容</div>
                    <div class="self-end">评论时间</div>
                </li> -->
            </ul>

            <button id="view14" type="button"
                onclick="window.location.href='/forum';"
                class="input-btn w-24 mx-auto"
            >Got it!</button>
        </form>
        {% endif %}

        {% if mode == "message"%}
        <form name="view_message" method="post">
            <label for="message_id">Message_ID</label>
            <input name="message_id" id="message_id" type="text" value="{{ information[0] }}" readonly class="input mb-3">

            <label for="Sender">Sender</label>
            <input name="Sender" id="Sender" type="text" value="{{information[6]}}" disabled class="input mb-3">

            <label for="Sender_ID">Sender_ID</label>
            <input name="Sender_ID" id="Sender_id" type="text" value="{{information[3]}}" disabled class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="Content" id="Content" rows="4" disabled class="input h-auto mb-3">{{information[4]}}</textarea>

            <label for="viewed">Viewed</label>
            <div class="mb-5 w-36 relative">
                <select name="viewed" id="viewed" required class="select w-full">
                    <option value=1>Read</option>
                    <option value=0>Unread</option>
                </select>
                <svg
                    class="absolute right-2 top-1.5 pointer-events-none"
                    viewBox="0 0 1024 1024"
                    xmlns="http://www.w3.org/2000/svg"
                    width="20"
                    height="20"
                ><path d="M819.2 403.2l-275.2 288c-19.2 19.2-44.8 19.2-64 0L204.8 403.2c-19.2-19.2-19.2-51.2 0-70.4 19.2-19.2 44.8-19.2 64 0l243.2 256 243.2-256c19.2-19.2 44.8-19.2 64 0 19.2 19.2 19.2 51.2 0 70.4z" fill="#6b7280"></path>
                </svg>
            </div>

            <input name="Read" id="Read" type="submit" value="Got it!" class="input-btn w-24 mx-auto">
        </form>
        {% endif %}

        {% if mode == "course"%}
        <form name="view_message" method="post">
            <label for="course_id">Message_ID</label>
            <input name="course_id" id="course_id" type="text" value="{{ courses[0] }}" readonly class="input mb-3">

            <label for="course_name">Sender</label>
            <input name="course_name" id="course_name" type="text" value="{{courses[1]}}" disabled class="input mb-3">

            <label for="instructor">Sender_ID</label>
            <input name="instructor" id="instructor" type="text" value="{{courses[2]}}" disabled class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="Content" id="Content1" rows="4" disabled class="input h-auto mb-3">{{courses[3]}}</textarea>

            <label for="viewed">Viewed</label>
            <div class="mb-3 w-36 relative">
                <select name="viewed" id="viewed1" required class="select w-full">
                    <option value=1>Read</option>
                    <option value=0>Unread</option>
                </select>
                <svg
                    class="absolute right-2 top-1.5 pointer-events-none"
                    viewBox="0 0 1024 1024"
                    xmlns="http://www.w3.org/2000/svg"
                    width="20"
                    height="20"
                ><path d="M819.2 403.2l-275.2 288c-19.2 19.2-44.8 19.2-64 0L204.8 403.2c-19.2-19.2-19.2-51.2 0-70.4 19.2-19.2 44.8-19.2 64 0l243.2 256 243.2-256c19.2-19.2 44.8-19.2 64 0 19.2 19.2 19.2 51.2 0 70.4z"></path>
                </svg>
            </div>

            <h3 class="mb-2">Student List</h3>
            <ul class="mb-5">
                {% for information in informations %}
                <li>{{ information[0] }} (ID: {{ information[1] }})</li>
                {% endfor %}
            </ul>

            <button id="view" onclick="window.location.href='/course';" class="input-btn w-24 mx-auto">Got it!</button>
        </form>
        {% endif %}

        {% if mode == "lecture"%}
        <form name="view_message" method="post">
            <label for="lecture_id">Lecture ID</label>
            <input name="lecture_id" id="lecture_id" type="text" value="{{ lectures[0] }}" readonly class="input mb-3">

            <label for="lecture_name">Lecture Name</label>
            <input name="lecture_name" id="lecture_name" type="text" value="{{lectures[2]}}" disabled class="input mb-3">

            <label for="instructor">Instructor</label>
            <input name="instructor" id="instructor1" type="text" value="{{lectures[3]}}" disabled class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="Content" id="Content2" rows="4" disabled class="input h-auto mb-5">{{lectures[4]}}</textarea>

            <button id="view1" onclick="window.location.href='/lecture';" class="input-btn w-24 mx-auto">Got it!</button>
        </form>
        {% endif %}

        {% if mode == "send"%}
        <form name="send_message" method="post">
            <label for="lecture_id">Receiver ID</label>
            <input name="id" id="lecture_id1" type="text" required class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="content" id="Content23" rows="4" required class="input h-auto mb-5"></textarea>

            <button id="view11" onclick="window.location.href='/message/send';" class="input-btn w-24 mx-auto">Send</button>
        </form>
        {% endif %}

        {% if mode == "assignment"%}
        <form name="view_assignment" method="post">
            <label for="assignment_id">Assignment ID</label>
            <input name="assignment_id" id="assignment_id" type="text" value="{{information[0]}}" readonly class="input mb-3">

            <label for="assignment_name">Assignment Name</label>
            <input name="assignment_name" id="assignment_name" type="text" value="{{information[4]}}" readonly class="input mb-3">

            <label for="course_name">Course Name</label>
            <input name="course_name" id="course_name1" type="text" value="{{information[5]}}" readonly class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="description" id="Content3" rows="4" disabled class="input h-auto mb-5">{{information[1]}}</textarea>

            <button id="view12" type="button" onclick="window.location.href='/assignment/page';" class="input-btn w-24 mx-auto">Got it!</button>
        </form>
        {% endif %}

        {% if mode == "student course"%}
        <form name="view_message" method="post">
            <label for="course_id">Message_ID</label>
            <input name="course_id" id="course_id7" type="text" value="{{ courses[0] }}" readonly class="input mb-3">

            <label for="course_name">Sender</label>
            <input name="course_name" id="course_name7" type="text" value="{{courses[1]}}" disabled class="input mb-3">

            <label for="instructor">Sender_ID</label>
            <input name="instructor" id="instructor7" type="text" value="{{courses[2]}}" disabled class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="Content" id="Content17" rows="4" disabled class="input h-auto mb-5">{{courses[3]}}</textarea>

            <button id="view221" onclick="window.location.href='/student';" class="input-btn w-24 mx-auto">Got it!</button>
        </form>
        {% endif %}

        {% if mode == "student course enroll"%}
        <form name="view_message" method="post">
            <label for="course_id">Message_ID</label>
            <input name="course_id" id="course_id54" type="text" value="{{ courses[0] }}" readonly class="input mb-3">

            <label for="course_name">Sender</label>
            <input name="course_name" id="course_name66" type="text" value="{{courses[1]}}" disabled class="input mb-3">

            <label for="instructor">Sender_ID</label>
            <input name="instructor" id="instructor66" type="text" value="{{courses[2]}}" disabled class="input mb-3">

            <label for="Content">Content</label>
            <textarea name="Content" id="Content12" rows="4" disabled class="input h-auto mb-5">{{courses[3]}}</textarea>

            <button id="view22" onclick="window.location.href='/enroll';" class="input-btn w-24 mx-auto">Got it!</button>
        </form>
        {% endif %}

        {% if mode == "Submission View"%}
        <form name="view_assignment" method="post">
            <label for="submission_id">Submission ID</label>
            <input name="submission_id" id="submission_id" type="text" value="{{information[0]}}" readonly class="input mb-3">

            <label for="assignment_id">Assignment ID</label>
            <input name="assignment_id" id="assignment_id7" type="text" value="{{information[2]}}" readonly class="input mb-3">

            <label for="score">Score</label>
            <input name="score" id="score" type="text" value="{{information[4]}}" readonly class="input mb-3">

            <label for="Content">Feedback</label>
            <textarea name="Feedback" id="Content36" rows="4" disabled class="input h-auto mb-5">{{information[5]}}</textarea>

            <button id="view13" type="button"
                onclick="window.location.href='/assignment/student/submitted';"
                class="input-btn w-24 mx-auto"
            >Got it!</button>
        </form>
        {% endif %}

    </div>
</body>

</html>